package com.ruoyi.chy.api.factory;


import com.ruoyi.chy.api.RemoteMerchantService;
import com.ruoyi.chy.api.domain.Merchant;
import com.ruoyi.chy.api.domain.MerchantVerification;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 用户服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteMerchantFallbackFactory implements FallbackFactory<RemoteMerchantService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteMerchantFallbackFactory.class);

    @Override
    public RemoteMerchantService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteMerchantService()
        {


            @Override
            public List<Merchant> getlist(String source) {
                return new ArrayList<>();
            }

            @Override
            public MerchantVerification getMerchantByPhone(String phone, String source) {
                return null;
            }
        };
    }
}
